﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="R-BOM.aspx.cs" Inherits="Main_Master_R_BOM" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
    <script type="text/javascript">
        function ShowBiggerImage(obj) {
            document.getElementById("LargeImageContainerDiv").style.display = "block";
            document.getElementById("LargeImageContainerDiv").innerHTML = "<img src='" + obj.src + "'>";
            //alert(document.getElementById("LargeImageContainerDiv").innerHTML);
        }
        function ShowDefaultImage(obj) {
            document.getElementById("LargeImageContainerDiv").style.display = "none";
            document.getElementById("LargeImageContainerDiv").innerHTML = "";
        }   
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="height: 10px;" align="center">
        <asp:Label ID="lblmsg" runat="server" ForeColor="Red" Visible="false"></asp:Label>
    </div>
    <acc:heading ID="header1" runat="server" HeadingText="R-BOM" />        
    <asp:Panel ID="pnlrbom" runat="server">
        <div align="center" style="width: 100%;">
            <table width="50%" class="tablecontent">
                <tr>
                    <td colspan="4" class="headtd">
                        R-BOM
                    </td>
                </tr>
                <tr>
                    <td>
                        Product Code<span style="color: Red;">*</span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtproductcode" runat="server" CssClass="inputnumber" Style="text-align: left;"></asp:TextBox>
                    </td>
                    <td>
                        Product Name<span style="color: Red;">*</span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtproductname" runat="server" CssClass="inputnumber" Style="text-align: left;"></asp:TextBox>
                    </td>
                </tr>
            </table>
        </div>
        <asp:ScriptManager ID="scrmgr" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="updatepnl" runat="server">
            <ContentTemplate>
                <center>
                    <div style="border: 1px solid #818181; width: 90%; margin-top: 20px;">
                        <div align="left">
                            <table width="100%">
                                <tr>
                                    <td align="left" width="70%">
                                        <asp:Button ID="btnAddNew" runat="server" Text="Add New" Width="90px" CssClass="button1"
                                            OnClick="btnAddNew_Click" />
                                    </td>
                                    <td align="right">
                                        Total Row(s):
                                        <asp:Label ID="lblrowno" runat="server" Text="3"></asp:Label>&nbsp;
                                    </td>
                                </tr>
                            </table>
                            <table cellpadding="2" cellspacing="0" width="100%" style="border: 1px solid #818181;">
                                <tr style="color: Black; font-size: 11px; font-family: Verdana; font-weight: bold;">
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8%;">
                                        Item Code
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8.5%;">
                                        MPN
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8%;">
                                        Item Name
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8%;">
                                        Addl Desc
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8%;">
                                        Unit Price
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8.6%;">
                                        Manufacture
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8%;">
                                        Total Lead Time
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 8%;">
                                        MOQ
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 9%;">
                                        Vendor Name
                                    </td>
                                    <td style="border-bottom: 1px solid #818181; text-align: center; font-weight: bold;
                                        width: 19%;">
                                        Picture
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div style="overflow:auto; height: 260px;">
                            <asp:HiddenField ID="hidsecond" Value="3" runat="server" />
                            <table id="tblrbom" runat="server" cellpadding="2" cellspacing="0" width="100%" style="border: 1px solid #818181;">
                                <tr>
                                    <td>
                                        <asp:TextBox ID="txtitemcode1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmpn1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtitemname1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtaddldesc1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtunitprice1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmanufacture1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txttotalleadtime1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmoq1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtvendorname1" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:FileUpload ID="FUPicture1" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:TextBox ID="txtitemcode2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmpn2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtitemname2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtaddldesc2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtunitprice2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmanufacture2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txttotalleadtime2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmoq2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtvendorname2" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:FileUpload ID="FUPicture2" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:TextBox ID="txtitemcode3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmpn3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtitemname3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtaddldesc3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtunitprice3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmanufacture3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txttotalleadtime3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtmoq3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtvendorname3" runat="server" Width="96%"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:FileUpload ID="FUPicture3" runat="server" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </center>
            </ContentTemplate>
        </asp:UpdatePanel>
        <table align="center">
            <tr>
                <td>
                    <asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="return validation();"
                        Width="90px" CssClass="button1" OnClick="btnSave_Click" />
                    <script type="text/javascript">
                        function validation() {
                            if (document.getElementById("txtproductcode").value == '') {
                                alert("Please Enter Product Code");
                                document.getElementById("txtproductcode").focus();
                                return false;
                            }
                            else if (document.getElementById("txtproductname").value == '') {
                                alert("Please Enter Product Name");
                                document.getElementById("txtproductname").focus();
                                return false;
                            }

                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                            //                        else if (document.getElementById("").value == '') {
                            //                            return false;
                            //                        }
                        }
                    </script>
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="90px" 
                        CssClass="button1" onclick="btnCancel_Click" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="pnlrbomview" runat="server" Visible="false" Width="90%">
        <div align="center">
            <asp:GridView ID="grdviewrbom" runat="server" AutoGenerateColumns="false" CssClass="gridview"
             RowStyle-CssClass="gridviewitem" AlternatingRowStyle-CssClass="gridview_alternate"
              Width="90%" ondatabound="grdviewrbom_DataBound" 
                onrowdatabound="grdviewrbom_RowDataBound">
                <Columns>
                    <asp:BoundField HeaderText="Product Code" DataField="Product_Code" />
                    <asp:BoundField HeaderText="Product Name" DataField="Product_Name" />
                    <asp:BoundField HeaderText="Item Code" DataField="Item_Code" />
                    <asp:BoundField HeaderText="MPN" DataField="MPN" />
                    <asp:BoundField HeaderText="Item Name" DataField="Item_Name" />
                    <asp:BoundField HeaderText="Addl Desc" DataField="Addldesc" />
                    <asp:BoundField HeaderText="Unit Price" DataField="Unit_Price" />
                    <asp:BoundField HeaderText="Manufacture" DataField="Manufacture" />
                    <asp:BoundField HeaderText="Total Lead Time" DataField="Total_led_Time" />
                    <asp:BoundField HeaderText="MOQ" DataField="MOQ" />
                    <asp:BoundField HeaderText="Vendor Name" DataField="Vendor_Name" />  
                    <asp:TemplateField HeaderText="Image">
                        <ItemTemplate>
                            <asp:Image id="imgitem" style="border:1px solid Black;" runat="server" ImageUrl='<%#Bind("Picture_Name")%>' Height="20px" Width="30px" onmouseover="ShowBiggerImage(this);" onmouseout="ShowDefaultImage(this);" />
                        </ItemTemplate>
                    </asp:TemplateField>              
                </Columns>
            </asp:GridView>
            <div id="LargeImageContainerDiv" style="position: absolute; display:none; left: 15%; top: 6%; border:10px Solid silver;"></div> 
        </div>
    </asp:Panel>
    </form>
</body>
</html>
